package pdd;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main3 {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        StringBuilder sb = new StringBuilder();
        int T = Integer.parseInt(s);
        for (int i = 0; i < T; i++){
            s = br.readLine();
            String[] s1 = s.split(" ");
            sb.append(fun(Integer.parseInt(s1[0]),Integer.parseInt(s1[1]))).append("\n");
        }
        System.out.print(sb.toString());

    }


    //返回能被m整除的最小n位正整数,如果不存在返回-1
    private static int fun(int n, int m) {
        int low = (int) Math.pow(10, n - 1);
        int high = (int) Math.pow(10, n);
        if (m >= high) return -1;
        int ans = m;
        while (ans < low) {
            ans += m;
        }
        return ans;
    }

}
